<template>
	<view class="flex-col h100">
		<view class="p-10">
			<template v-if="list.length > 0">
				<view class="card" v-for="(item,index) in list" :index="index" @click="goDetail(item)">
					<view class="title fw">
						{{item.name}}
					</view>
					<view class="flex m-between s-center">
						<view class="flex-col">
							<text class="m-t-8">{{item.name}}</text>
						</view>
						<!-- <view class="bnt" @click="goDetail(item)">
							<up-text type="primary" text="申请"></up-text>
						</view> -->
					</view>
				</view>
			</template>
			<u-empty v-else mode="data">
			</u-empty>
		</view>
	</view>
	<u-back-top :scroll-top="scrollTop" top="600"></u-back-top>
</template>
<script setup>
	import {
		reactive
	} from "vue";
	import {
		onShow,
	} from '@dcloudio/uni-app'
	import useList from '@/hooks/useList.js'
	import {
		getactivepage
	} from '@/api/flowPath.js'

	let queryParams = reactive({
		pageNum: 1,
		pageSize: 10,
	})

	const {
		getListData,
		list,
		scrollTop,
	} = useList({
		queryParams,
		api: {
			page: getactivepage
		}
	})

	const goDetail = (item) => {
		if (item.flowKey === 'highRiskWorkApply') {
			uni.navigateTo({
				url: '/pages/professional/riskOperations/highRiskWork/add?procdefId=' + JSON.stringify(item
					.id)
			})
		} else {
			uni.showToast({
				icon: 'error',
				title: '暂无配置'
			})
		}

	}

	onShow(() => {
		getListData()
	})
</script>
<style lang="scss" scoped>
	.card {
		padding: 20rpx;
		background-color: #fff;
		border-radius: 20rpx;
		margin-top: 20rpx;

		&:first-child {
			margin-top: 0;
		}
	}

	.bnt {
		width: 100rpx;
	}
</style>